VERSION 5.00
Begin VB.Form frmCOD 
   BackColor       =   &H00FFFFFF&
   Caption         =   "COD (Collect on Delivery) Information"
   ClientHeight    =   6510
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6390
   Icon            =   "frmCOD.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   6510
   ScaleWidth      =   6390
   StartUpPosition =   1  'CenterOwner
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "COD"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   2715
      Left            =   120
      TabIndex        =   24
      Top             =   120
      Width           =   6135
      Begin VB.CheckBox chkCOD1stPiece 
         BackColor       =   &H00FFFFFF&
         Caption         =   "COD on First Piece Only"
         Height          =   255
         Left            =   2400
         TabIndex        =   28
         Top             =   2340
         Width           =   2835
      End
      Begin VB.CheckBox f3014 
         BackColor       =   &H00FFFFFF&
         Caption         =   "ECOD"
         Height          =   255
         Left            =   2400
         TabIndex        =   5
         Top             =   1980
         Width           =   1995
      End
      Begin VB.TextBox f53 
         Height          =   315
         Left            =   2400
         TabIndex        =   0
         Top             =   240
         Width           =   1935
      End
      Begin VB.CheckBox f186 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Add Freight Charges to COD Amount"
         Height          =   375
         Left            =   2400
         TabIndex        =   4
         Top             =   1560
         Width           =   3135
      End
      Begin VB.Frame Frame3 
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         Caption         =   "Frame1"
         Height          =   975
         Left            =   840
         TabIndex        =   25
         Top             =   600
         Width           =   5175
         Begin VB.OptionButton optCollectType 
            BackColor       =   &H00FFFFFF&
            Caption         =   "Secured Check"
            Height          =   375
            Index           =   0
            Left            =   1560
            TabIndex        =   1
            Top             =   0
            Width           =   3615
         End
         Begin VB.OptionButton optCollectType 
            BackColor       =   &H00FFFFFF&
            Caption         =   "Non-Secured Check"
            Height          =   255
            Index           =   1
            Left            =   1560
            TabIndex        =   2
            Top             =   360
            Width           =   3615
         End
         Begin VB.OptionButton optCollectType 
            BackColor       =   &H00FFFFFF&
            Caption         =   "Currency ONLY"
            Height          =   315
            Index           =   2
            Left            =   1560
            TabIndex        =   3
            Top             =   660
            Width           =   3615
         End
         Begin VB.Label Label11 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00FFFFFF&
            Caption         =   "Collection Type:"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   0
            TabIndex        =   26
            Top             =   60
            Width           =   1455
         End
      End
      Begin VB.Label Label1 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Amount:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   960
         TabIndex        =   27
         Top             =   300
         Width           =   1335
      End
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Remittance Address"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   2955
      Left            =   120
      TabIndex        =   16
      Top             =   2940
      Width           =   6135
      Begin VB.TextBox f1241 
         Height          =   315
         Left            =   1860
         TabIndex        =   9
         Top             =   1380
         Width           =   3975
      End
      Begin VB.TextBox f1240 
         Height          =   315
         Left            =   1860
         TabIndex        =   8
         Top             =   1020
         Width           =   3975
      End
      Begin VB.TextBox f1238 
         Height          =   315
         Left            =   1860
         TabIndex        =   7
         Top             =   660
         Width           =   3975
      End
      Begin VB.TextBox f1242 
         Height          =   315
         Left            =   1860
         TabIndex        =   10
         Top             =   1740
         Width           =   3975
      End
      Begin VB.TextBox f1244 
         Height          =   315
         Left            =   4740
         TabIndex        =   12
         Top             =   2100
         Width           =   1095
      End
      Begin VB.TextBox f439 
         Height          =   315
         Left            =   1860
         TabIndex        =   6
         Top             =   300
         Width           =   3975
      End
      Begin VB.TextBox f1237 
         Height          =   315
         Left            =   1860
         TabIndex        =   13
         Top             =   2460
         Width           =   3975
      End
      Begin VB.ComboBox f1243 
         Height          =   315
         Left            =   1860
         TabIndex        =   11
         Top             =   2100
         Width           =   2175
      End
      Begin VB.Label Label18 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "City:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   180
         TabIndex        =   23
         Top             =   1800
         Width           =   1575
      End
      Begin VB.Label Label17 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Address:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   180
         TabIndex        =   22
         Top             =   1080
         Width           =   1575
      End
      Begin VB.Label Label16 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Zip:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   4140
         TabIndex        =   21
         Top             =   2160
         Width           =   495
      End
      Begin VB.Label Label15 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "State:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   180
         TabIndex        =   20
         Top             =   2160
         Width           =   1575
      End
      Begin VB.Label Label14 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Contact Name:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   180
         TabIndex        =   19
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label13 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Company Name:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   180
         TabIndex        =   18
         Top             =   720
         Width           =   1575
      End
      Begin VB.Label Label12 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFFFFF&
         Caption         =   "Telephone:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   180
         TabIndex        =   17
         Top             =   2520
         Width           =   1575
      End
   End
   Begin VB.CommandButton cmdSave 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "Save/Exit"
      Height          =   315
      Left            =   1680
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   14
      Top             =   6060
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.CommandButton cmdCancel 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "Cancel"
      Height          =   315
      Left            =   3480
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   15
      Top             =   6060
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
End
Attribute VB_Name = "frmCOD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'---------------------------------------------------------------------------------------
' Procedure : cmdCancel_Click()
' DateTime  : 2/18/2004
' Purpose   : Cancel button hides form
'---------------------------------------------------------------------------------------
'
Private Sub cmdCancel_Click()
    Me.Hide
    frmShip.SetFocus
End Sub
'---------------------------------------------------------------------------------------
' Procedure : cmdSave_Click()
' DateTime  : 2/18/2004
' Purpose   : Save button assigns COD fields to global vars and saves COD return address
'           : to registry.
'---------------------------------------------------------------------------------------
'
Private Sub cmdSave_Click()
    'COD Amount
    g_str53 = f53
    'Pay type Express
    If Left(frmShip.f1274, 2) <> "92" Then
        g_str54 = IIf(optCollectType(0), "Y", "N")
    'Pay type Ground
    Else
        If optCollectType(0) Then
            g_str3000 = "1"
        ElseIf optCollectType(1) Then
            g_str3000 = "2"
        Else
            g_str3000 = "3"
        End If
    End If
    
    'Add freight chgs
    g_str186 = IIf(f186 = 1, "Y", "")
    'ECOD
    g_str3014 = IIf(f3014 = 1 And frmShip.f27(2) = 1, "Y", "")
    
    g_str439 = f439
    g_str1237 = f1237
    g_str1238 = f1238
    g_str1240 = f1240
    g_str1241 = f1241
    g_str1242 = f1242
    g_str1243 = Left(f1243, 2)
    g_str1244 = f1244
    
    With g_clsReg
        .SetRegistryValue "ECOD", f3014, REG_SZ
        .SetRegistryValue "COD1stPiece", chkCOD1stPiece, REG_SZ
        .SetRegistryValue "CODContact", f439, REG_SZ
        .SetRegistryValue "CODCompany", f1238, REG_SZ
        .SetRegistryValue "CODAddress", f1240, REG_SZ
        .SetRegistryValue "CODAddress2", f1241, REG_SZ
        .SetRegistryValue "CODCity", f1242, REG_SZ
        .SetRegistryValue "CODState", Left(f1243, 2), REG_SZ
        .SetRegistryValue "CODZip", f1244, REG_SZ
        .SetRegistryValue "CODPhone", f1237, REG_SZ
    End With
    Me.Hide
    frmShip.SetFocus
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f1237_Change()
' DateTime  : 2/18/2004
' Purpose   : COD phone is numeric only with max length of 10
'---------------------------------------------------------------------------------------
'
Private Sub f1237_Change()
    Call NumericOnly(f1237, False)
    Call CheckLength(f1237, 10)
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f1243_Change()
' DateTime  : 8/9/2004
' Purpose   : Calls a routine to populate the entire text of selected state.
'---------------------------------------------------------------------------------------
'
Private Sub f1243_Change()
    If Len(f1243) >= 2 Then
        Call SetComboSelection(f1243, f1243)
    End If
    
End Sub

'---------------------------------------------------------------------------------------
' Procedure : f1244_Change()
' DateTime  : 2/18/2004
' Purpose   : COD ZIP is numeric only with max length of 5
'---------------------------------------------------------------------------------------
'
Private Sub f1244_Change()
    Call NumericOnly(f1244, False)
    Call CheckLength(f1244, 5)
End Sub
'---------------------------------------------------------------------------------------
' Procedure : f53_Change()
' DateTime  : 2/18/2004
' Purpose   : COD Amount is numeric only, decimal allowed.
'---------------------------------------------------------------------------------------
'
Private Sub f53_Change()
    Call NumericOnly(f53)
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_Activate()
' DateTime  : 2/18/2004
' Purpose   : When form is shown get COD values from registry. If nothing is saved use
'           : current shipper info.
'---------------------------------------------------------------------------------------
'
Private Sub Form_Activate()
    'Get saved settings from registry. If nothing saved use values
    'from Setup form
    With g_clsReg
        .hkey = HKEY_LOCAL_MACHINE
        .KeyRoot = MAINKEYROOT
        .Subkey = MAINSUBKEY
        'Create Settings key if it doesn't exist
        If Not .KeyExists Then .CreateKey
        'Get saved Settings
        f3014 = .GetRegistryValue("ECOD", 0)
        chkCOD1stPiece = .GetRegistryValue("COD1stPiece", 0)
        f439 = .GetRegistryValue("CODContact", frmSetup.f32)
        f1238 = .GetRegistryValue("CODCompany", frmSetup.f4)
        f1240 = .GetRegistryValue("CODAddress", frmSetup.f5)
        f1241 = .GetRegistryValue("CODAddress2", "")
        f1242 = .GetRegistryValue("CODCity", frmSetup.f7)
        f1243 = .GetRegistryValue("CODState", Left(frmSetup.f8, 2))
        f1244 = .GetRegistryValue("CODZip", frmSetup.f9)
        f1237 = .GetRegistryValue("CODPhone", frmSetup.f183)
    End With
    
    'Make an initial setting for radio buttons
    optCollectType(0).Value = True

    'Set focus to COD Amount field
    f53.SetFocus
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_KeyDown()
' DateTime  : 2/17/2005
' Purpose   : Enter key pressed sends a TAB to move to next field
'---------------------------------------------------------------------------------------
'
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If Not TypeOf Me.ActiveControl Is CommandButton Then
        If Shift = 0 And KeyCode = 13 Then
            SendKeys "{TAB}"
        End If
    End If
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Form_Load()
' DateTime  : 1/27/2005
' Purpose   : When form loads, load State and Country fields.
'---------------------------------------------------------------------------------------
'
Private Sub Form_Load()
    
    'Initialize State combo
    If Left(frmSetup.f117, 2) = "US" Then
        Call LoadStates(f1243)
    ElseIf Left(frmSetup.f117, 2) = "CA" Then
        Call LoadProvinces(f1243)
    End If

End Sub
